
#include "hashmanger.h"

volatile double HashManger::i = 0;
volatile double HashManger::shot = 0;
HashManger::HashManger(QObject *parent) : QObject(parent){
}


void HashManger::load_future(char complete_chess_num, char depth){
    char future_num =  complete_chess_num + 2;
    bool will_del = true;
    if(complete_chess_num  == 8 || complete_chess_num == 7) will_del = false;
    int max_num = future_num + depth;
    load_thread[0] = new std::thread([this,max_num,will_del](){
        load(max_num,will_del);
    });
    load_thread[1] = new std::thread([this,max_num,will_del](){
        load(max_num - 2,will_del);
    });
    load_thread[0]->detach();
    load_thread[1]->detach();
}

void HashManger::load_current(char now_num, char depth){
    bool will_del = true;
    if(now_num  == 8 || now_num == 7) will_del = false;
    char max_num = now_num + depth;
    load_thread[0] = new std::thread([this,max_num,will_del](){
        load(max_num,will_del);
    });
    load_thread[1] = new std::thread([this,max_num,will_del](){
        load(max_num - 2,will_del);
    });
    load_thread[0]->detach();
    load_thread[1]->detach();
}
